Skip to content

Conversation

@JoeKar
Copy link
Collaborator

@JoeKar JoeKar commented Oct 13, 2023

With the introduction of the new callback it's possible for plugins to react upon changed buffer settings.
Especially the linter plugin will benefit by this change, since it can the properly unregister messages created with a different linter type.

Fixes #2961
Fixes #3587


makeLinter("gcc", "c", "gcc", {"-fsyntax-only", "-Wall", "-Wextra", "%f"}, "%f:%l:%c:.+: %m")
makeLinter("g++", "c++", "gcc", {"-fsyntax-only","-std=c++14", "-Wall", "-Wextra", "%f"}, "%f:%l:%c:.+: %m")
makeLinter("g++", "c++", "g++", {"-fsyntax-only","-std=c++14", "-Wall", "-Wextra", "%f"}, "%f:%l:%c:.+: %m")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note: this change might be unnecessary (though will not hurt either), since it's basically the same compiler.

BTW... it might be a good idea to remove the -std=c++14 param, to support newer versions of the standard.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the forced standard is a good idea, to go with the actual GCC defined defaults.

Regarding the invoked checker/compiler I had different experiences, due to the different defaults applied by gcc vs g++. Exactly this was the reason why we receive unexpected linter messages when saving a C++ file. So I really recommend to go with the explicit GNU C++ compiler for C++ files.

@JoeKar JoeKar force-pushed the fix/linter-ft-relation branch from 85bb039 to 33244e4 Compare December 28, 2024 20:05
@JoeKar JoeKar force-pushed the fix/linter-ft-relation branch from 33244e4 to 85e2db0 Compare December 29, 2024 12:37
@JoeKar JoeKar force-pushed the fix/linter-ft-relation branch from 85e2db0 to 11dfbf9 Compare December 29, 2024 20:03
b.OptionCallback(option, nativeValue)
}

_, err := config.RunPluginFnBool(b.Settings, "onBufferOptionChanged",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why Bool?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the boolean result is ignored it doesn't seem to be necessary, except the other small difference that RunPluginFnBool() checks for buffer local settings[p.Name] being unset, which RunPluginFn() doesn't. Therefore with RunPluginFnBool() the callback isn't called in plugins which are disabled after loading, while with RunPluginFn() it is...which is an inconsistency on his own.

@JoeKar JoeKar force-pushed the fix/linter-ft-relation branch from 11dfbf9 to dcf064a Compare December 30, 2024 11:53
@JoeKar JoeKar force-pushed the fix/linter-ft-relation branch from dcf064a to d1f54ea Compare December 31, 2024 12:27
@JoeKar JoeKar merged commit 99a27db into zyedidia:master Jan 1, 2025
6 checks passed
@JoeKar JoeKar deleted the fix/linter-ft-relation branch January 1, 2025 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update C++ linter to use gcc default version of C++ Editor gets angry with C++ in Header files.

2 participants